﻿using System.Deployment.Application;
using System.Diagnostics;
using System.Reflection;
using System.Windows;
using System.Windows.Controls;

using Writespace.Dialogs.Properties;

namespace Writespace.Dialogs
{
    /// <summary>
    /// Interaction logic for OptionsWindow.xaml
    /// </summary>
    public partial class OptionsWindow : Window
    {
        public OptionsWindow()
        {
            InitializeComponent();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var button = sender as Button;

            if (button == null)
                return;

            if ((string) button.Content == "SAVE")
            {
                DialogResult = true;
                Settings.Default.Save();
            }

            Close();
        }

        private void CodeplexLink_Click(object sender, RoutedEventArgs e)
        {
            Process.Start("http://www.codeplex.com/writespace");
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //if (ApplicationDeployment.IsNetworkDeployed)
            //    VersionInfo.Text = "ClickOnce Version " + ApplicationDeployment.CurrentDeployment.CurrentVersion;
            //else
                VersionInfo.Text = "Version " + Assembly.GetExecutingAssembly().GetName().Version;
        }
    }
}